<div class="bjui-pageContent">
    <div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
        <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#process-dict-lists')}">
            <fieldset>
                <legend style="font-weight:normal;">搜索：</legend>
                <div style="margin:0; padding:1px 5px 5px;">

                    <span>名称：</span>
                    <input type="text" name="title" class="form-control" size="30">

                    <span>类型：</span>
                    <select name="type" data-toggle="selectpicker">
                        <option value="">全部</option>
                        @foreach ($typeList as $val)
                            <option value="{{$val['id']}}">{{$val['title']}}</option>
                        @endforeach
                    </select>

                    <div class="btn-group">
                        <button type="submit" class="btn-green" data-icon="search">开始搜索</button>
                        <button type="reset" class="btn-orange" data-icon="times">重置</button>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
    <p><button type="button" class="btn-default" data-toggle="navtab" data-options="{id:'process-field-type-categroy-navtab',fresh:true,url:'admin/process/field-category-list', title:'字段分类列表'}">字段分类列表</button></p>
    <table class="table table-bordered" id="process-dict-lists" data-toggle="datagrid" data-options="{
        tableWidth: '100%',
        height: '100%',
        gridTitle : '工序字典列表',
        showToolbar: true,
        toolbarItem: '{{$toolbarItem}}',
        local: 'local',
        dataUrl: '/admin/process/dict-list',
        linenumberAll: false,
        showLinenumber: false,
        showCheckboxcol: true,
        filterThead: false,
        showEditbtnscol: '操作',
        customEditbtns:{ position:'replace',buttons:editButton,width:0},
        editUrl: '/admin/process/dict-edit',
        //editCallback:editCallback,
        afterSave:afterSave,
        //delUrl:'/admin/process/dict-delete',
        //delPK:'id',
        //delConfirm: true,
        exportOption:{type:'file', options:{url:'admin/export/process-field',type:'post',data: {_token : '{{ csrf_token() }}'}}}
    }">
        <thead>
        <tr>
            <th data-options="{name:'id',width:50,align:'center',add:false,edit:false}">编号</th>
            <th data-options="{name:'field_name',add:false,edit:false,align:'center'}">字段名称</th>
            <th data-options="{name:'title',align:'center'}">名称</th>
            <th data-options="{name:'type',type:'select',items:{{$typeListJson}},align:'center'}">类型</th>
            <th data-options="{name:'placeholder',align:'center'}">提示语</th>
            <th data-options="{name:'text_type',type:'select',items:[{0:'字符'},{1:'数字'},{2:'带小数点数字'}],align:'center'}">文本类型</th>
            <th data-options="{name:'field_type',type:'select',items:{{$fieldTypeList}},align:'center'}">字段类型</th>
            <th data-options="{align:'center',width:200,render:selectCategory}">选择材料分类</th>
        </tr>
        </thead>
    </table>
</div>>
<script type="text/javascript">
    function selectCategory(value, data){
        var category_html  = '<button type="button" class="btn btn-info" data-toggle="dialog" data-options="';
        category_html  += '{id:\'process-dict-category-dialog\',title:\''+data.title+'选择材料分类\',';
        category_html  += 'fresh:true,';
        category_html  += 'height:400,width:400,';
        category_html  += 'url:\'/admin/process/dict-category-list\',data:{field_id:' + data.id + '}}';
        category_html  += '">选择材料分类</button>';
        var html    = '';
        if( data.field_type == 4 ){
            html    = category_html;
        }
        return html;
    }
    function afterSave(m,n)
    {
        var html = m.find('.delete').hide();
    }
</script>